package grafico;

import java.awt.Color;
import java.awt.Font;

import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JTextField;
import javax.swing.JSpinner;
import javax.swing.JList;
import javax.swing.ListSelectionModel;
import javax.swing.JComboBox;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JTable;
import javax.swing.JScrollPane;
import javax.swing.table.DefaultTableModel;
import javax.swing.JButton;
import java.awt.SystemColor;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class GestionarPasajero_02 extends JPanel {
	private JTextField textNombres;
	private JLabel lblsubTitulo;
	private JLabel lblNombres;
	private JLabel lblGestionarPasajero;
	private JLabel icono;
	private JTextField textApellido;
	private JTextField textNroDoc;
	private JTable table;

	/**
	 * Create the panel.
	 */
	public GestionarPasajero_02(final PantallaPrincipal frame) {
		{
			ImageIcon img=new ImageIcon(this.getClass().getResource("/imagenes/icono.jpg"));
			
			setBackground(new Color(105, 105, 105));
			setForeground(new Color(128, 128, 0));
			
			
			icono = new JLabel(img);
			icono.setBounds(677, 11, 142, 141);
			
			lblGestionarPasajero = new JLabel("Gestionar Pasajero");
			lblGestionarPasajero.setBounds(70, 55, 286, 37);
			lblGestionarPasajero.setForeground(Color.WHITE);
			lblGestionarPasajero.setBackground(Color.WHITE);
			lblGestionarPasajero.setFont(new Font("Tahoma", Font.BOLD, 30));
			
			lblsubTitulo = new JLabel("Ingrese los datos del pasajero a modificar");
			lblsubTitulo.setBounds(70, 162, 360, 21);
			lblsubTitulo.setForeground(new Color(250, 128, 114));
			lblsubTitulo.setFont(new Font("Tahoma", Font.BOLD, 17));
			
			lblNombres = new JLabel("Nombres:");
			lblNombres.setBounds(70, 207, 70, 20);
			lblNombres.setForeground(new Color(192, 192, 192));
			lblNombres.setFont(new Font("Tahoma", Font.PLAIN, 16));
			
			textNombres = new JTextField();
			textNombres.setBounds(153, 207, 218, 20);
		

	}
		
		JLabel lblApellido = new JLabel("Apellido:");
		lblApellido.setBounds(402, 207, 70, 20);
		lblApellido.setForeground(Color.LIGHT_GRAY);
		lblApellido.setFont(new Font("Tahoma", Font.PLAIN, 16));
		
		textApellido = new JTextField();
		textApellido.setBounds(546, 207, 218, 20);
	
		
		JLabel lblTipoDeDocumento = new JLabel("Tipo de documento:\r\n");
		lblTipoDeDocumento.setBounds(70, 259, 152, 20);
		lblTipoDeDocumento.setForeground(Color.LIGHT_GRAY);
		lblTipoDeDocumento.setFont(new Font("Tahoma", Font.PLAIN, 16));
		setLayout(null);
		add(lblGestionarPasajero);
		add(lblNombres);
		add(textNombres);
		add(lblApellido);
		add(lblsubTitulo);
		add(textApellido);
		add(icono);
		add(lblTipoDeDocumento);
		
		JComboBox comboBox_TipoDoc = new JComboBox();
		comboBox_TipoDoc.setModel(new DefaultComboBoxModel(new String[] {"DNI", "LU"}));
		comboBox_TipoDoc.setBounds(225, 261, 64, 20);
		add(comboBox_TipoDoc);
		
		JLabel lblNDeDocumento = new JLabel("N\u00B0\r\n de documento:\r\n");
		lblNDeDocumento.setForeground(Color.LIGHT_GRAY);
		lblNDeDocumento.setFont(new Font("Tahoma", Font.PLAIN, 16));
		lblNDeDocumento.setBounds(402, 259, 152, 20);
		add(lblNDeDocumento);
		
		textNroDoc = new JTextField();
		textNroDoc.setBounds(546, 259, 218, 20);
		add(textNroDoc);
		
		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBounds(70, 336, 694, 111);
		add(scrollPane);
		
		table = new JTable();
		table.setModel(new DefaultTableModel(
			new Object[][] {
			},
			new String[] {
				"Apellido", "Nombres", "Tipo de documento", "Numero de documento"
			}
		) {
			boolean[] columnEditables = new boolean[] {
				false, true, false, false
			};
			public boolean isCellEditable(int row, int column) {
				return columnEditables[column];
			}
		});
		scrollPane.setViewportView(table);
		
		JButton btnBuscar = new JButton("Siguiente");
		btnBuscar.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				altaPasajero(frame);
			}
		});
		btnBuscar.setBackground(SystemColor.scrollbar);
		btnBuscar.setFont(new Font("Tahoma", Font.PLAIN, 16));
		btnBuscar.setForeground(new Color(70, 130, 180));
		btnBuscar.setBounds(677, 514, 109, 23);
		add(btnBuscar);
		
		JButton button = new JButton("Buscar");
		button.setBackground(SystemColor.scrollbar);
		button.setForeground(new Color(70, 130, 180));
		button.setFont(new Font("Tahoma", Font.PLAIN, 16));
		button.setBounds(677, 480, 109, 23);
		add(button);
		
		JButton btnVolver = new JButton("Volver\r\n");
		btnVolver.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				menu(frame);
			}
		});
		btnVolver.setBackground(SystemColor.scrollbar);
		btnVolver.setForeground(new Color(70, 130, 180));
		btnVolver.setFont(new Font("Tahoma", Font.PLAIN, 16));
		btnVolver.setBounds(677, 548, 109, 23);
		add(btnVolver);
	}
	private void menu(PantallaPrincipal frame) {
		this.setVisible(false);
		frame.setContentPane(new Menu(frame));
		
	}
	private void altaPasajero(PantallaPrincipal frame) {
		this.setVisible(false);
		frame.setContentPane(new AltaPasajero_11(frame));
		
	}
}